package com.gfxy.modules.items.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gfxy.modules.common.entity.MemberList;
import com.gfxy.modules.excel.ExcelUtil;
import com.gfxy.modules.items.entity.Qtxmhxzb;
import com.gfxy.modules.items.mapper.QtxmhxzbMapper;
import com.gfxy.modules.items.service.IQtxmhxzbService;
import com.gfxy.modules.items.vo.BzscMemberPage;
import com.gfxy.modules.items.vo.QtxmhxzbMemberPage;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.util.ImportExcelUtil;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.io.InputStream;
import java.io.PushbackInputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Collection;

/**
 * @Description: 其他项目-核心指标
 * @Author: jeecg-boot
 * @Date:   2024-01-04
 * @Version: V1.0
 */
@Service
public class QtxmhxzbServiceImpl extends AbstractProjectServiceImpl<QtxmhxzbMapper, Qtxmhxzb> implements IQtxmhxzbService {

	public QtxmhxzbServiceImpl() {
		this.memberCellNum = 3;
	}
	@Override
	public Double getTotalScore(Qtxmhxzb qtxmhxzb) {
		return 0.0;
	}

	@Override
	public IPage<QtxmhxzbMemberPage> selectListPage(String date, Integer pageNo, Integer pageSize) {
		Page<QtxmhxzbMemberPage> page = new Page<>(pageNo, pageSize);

		Page<QtxmhxzbMemberPage> page1 = page.setRecords(baseMapper.selectMemberPageListByYear(date));

		return page1;
	}

	@Override
	public List<QtxmhxzbMemberPage> getMemberPageListByYear(String date) {
		return baseMapper.selectMemberPageListByYear(date);
	}

	@Override
	protected Qtxmhxzb getOneProject(Row row) {
		String date =  ExcelUtil.formatCell(row.getCell(0));
		String name =  ExcelUtil.formatCell(row.getCell(1));
		String score = ExcelUtil.formatCell(row.getCell(2));

		Qtxmhxzb qtxmhxzb = new Qtxmhxzb();
		qtxmhxzb.setDate(date);
		qtxmhxzb.setProjectName(name);
		qtxmhxzb.setTotalScore(Double.valueOf(score));


		return qtxmhxzb;
	}


}
